<html>
<head><meta charset="utf-8"><title>where FxHashMap implements TyEncodable · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20FxHashMap.20implements.20TyEncodable.html">where FxHashMap implements TyEncodable</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="241556206"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20FxHashMap%20implements%20TyEncodable/near/241556206" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20FxHashMap.20implements.20TyEncodable.html#241556206">(Jun 04 2021 at 15:57)</a>:</h4>
<p>looking at <a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_middle/src/ty/context.rs#L333-L334">https://github.com/rust-lang/rust/blob/master/compiler/rustc_middle/src/ty/context.rs#L333-L334</a></p>



<a name="241556317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20FxHashMap%20implements%20TyEncodable/near/241556317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20FxHashMap.20implements.20TyEncodable.html#241556317">(Jun 04 2021 at 15:58)</a>:</h4>
<p>and how then <code>TypeckResults</code> has a field with type <code>FxHashMap</code> <a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_middle/src/ty/context.rs#L427">https://github.com/rust-lang/rust/blob/master/compiler/rustc_middle/src/ty/context.rs#L427</a></p>



<a name="241556351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20FxHashMap%20implements%20TyEncodable/near/241556351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20FxHashMap.20implements.20TyEncodable.html#241556351">(Jun 04 2021 at 15:59)</a>:</h4>
<p>I was wondering where is <code>TyEncodable</code> implemented for <code>FxHashMap</code></p>



<a name="241556389"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20FxHashMap%20implements%20TyEncodable/near/241556389" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20FxHashMap.20implements.20TyEncodable.html#241556389">(Jun 04 2021 at 15:59)</a>:</h4>
<p>I guess that happens somewhere on <code>rustc_middle</code>?</p>



<a name="241556402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20FxHashMap%20implements%20TyEncodable/near/241556402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20FxHashMap.20implements.20TyEncodable.html#241556402">(Jun 04 2021 at 15:59)</a>:</h4>
<p>still searching but couldn't find where that happens</p>



<a name="241556438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20FxHashMap%20implements%20TyEncodable/near/241556438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20FxHashMap.20implements.20TyEncodable.html#241556438">(Jun 04 2021 at 15:59)</a>:</h4>
<p><code>TyEncodable</code> basically means <code>Encodable</code> except the encoder is limited to an <code>TyEncoder</code>. <code>FxHashMap</code> is implemented for all encoders.</p>



<a name="241556446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20FxHashMap%20implements%20TyEncodable/near/241556446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20FxHashMap.20implements.20TyEncodable.html#241556446">(Jun 04 2021 at 15:59)</a>:</h4>
<p>It's done in <code>rustc_serialize</code> for <code>HashMap</code></p>



<a name="241556515"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20FxHashMap%20implements%20TyEncodable/near/241556515" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20FxHashMap.20implements.20TyEncodable.html#241556515">(Jun 04 2021 at 16:00)</a>:</h4>
<p>and is generic over the hasher</p>



<a name="241556520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20FxHashMap%20implements%20TyEncodable/near/241556520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20FxHashMap.20implements.20TyEncodable.html#241556520">(Jun 04 2021 at 16:00)</a>:</h4>
<p>(I just so happen to be working on a large refactoring of rustc_serialize)</p>



<a name="241556544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20FxHashMap%20implements%20TyEncodable/near/241556544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20FxHashMap.20implements.20TyEncodable.html#241556544">(Jun 04 2021 at 16:00)</a>:</h4>
<p>great, thanks</p>



<a name="241556635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20FxHashMap%20implements%20TyEncodable/near/241556635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20FxHashMap.20implements.20TyEncodable.html#241556635">(Jun 04 2021 at 16:01)</a>:</h4>
<p>yeah I was changing the type of that to something else that also comes from <code>rustc_data_structures</code> and wanted to see where's that done</p>



<a name="241556856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20FxHashMap%20implements%20TyEncodable/near/241556856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20FxHashMap.20implements.20TyEncodable.html#241556856">(Jun 04 2021 at 16:02)</a>:</h4>
<p>would make sense then if I add an impl for that here <a href="https://github.com/rust-lang/rust/blob/522eda554fbe606d06a3f94d2bfcb380742038ac/compiler/rustc_serialize/src/collection_impls.rs">https://github.com/rust-lang/rust/blob/522eda554fbe606d06a3f94d2bfcb380742038ac/compiler/rustc_serialize/src/collection_impls.rs</a> ?</p>



<a name="241556860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20FxHashMap%20implements%20TyEncodable/near/241556860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20FxHashMap.20implements.20TyEncodable.html#241556860">(Jun 04 2021 at 16:02)</a>:</h4>
<p>I think so</p>



<a name="241557063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20FxHashMap%20implements%20TyEncodable/near/241557063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20FxHashMap.20implements.20TyEncodable.html#241557063">(Jun 04 2021 at 16:03)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/where.20FxHashMap.20implements.20TyEncodable/near/241556856">said</a>:</p>
<blockquote>
<p>would make sense then if I add an impl for that here <a href="https://github.com/rust-lang/rust/blob/522eda554fbe606d06a3f94d2bfcb380742038ac/compiler/rustc_serialize/src/collection_impls.rs">https://github.com/rust-lang/rust/blob/522eda554fbe606d06a3f94d2bfcb380742038ac/compiler/rustc_serialize/src/collection_impls.rs</a> ?</p>
</blockquote>
<p>How do you mean? <code>FxHashMap</code> already implements <code>Encodable</code>.</p>



<a name="241557173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20FxHashMap%20implements%20TyEncodable/near/241557173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20FxHashMap.20implements.20TyEncodable.html#241557173">(Jun 04 2021 at 16:04)</a>:</h4>
<p>I've added <code>VecMap</code> to <code>rustc_data_structures</code> and changed the type of <a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_middle/src/ty/context.rs#L427">https://github.com/rust-lang/rust/blob/master/compiler/rustc_middle/src/ty/context.rs#L427</a> to use it</p>



<a name="241557201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20FxHashMap%20implements%20TyEncodable/near/241557201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20FxHashMap.20implements.20TyEncodable.html#241557201">(Jun 04 2021 at 16:04)</a>:</h4>
<p>so I'd need that <code>VecMap</code> to also be Encodable/Decodable</p>



<a name="241557283"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20FxHashMap%20implements%20TyEncodable/near/241557283" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20FxHashMap.20implements.20TyEncodable.html#241557283">(Jun 04 2021 at 16:05)</a>:</h4>
<p>Ah, then the <code>Encodable</code> and <code>Decodable</code> impls for <code>VecMap</code> need to be in rustc_data_structures I think.</p>



<a name="241557737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20FxHashMap%20implements%20TyEncodable/near/241557737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20FxHashMap.20implements.20TyEncodable.html#241557737">(Jun 04 2021 at 16:08)</a>:</h4>
<p>but that would generate a dependency of <code>rustc_middle</code></p>



<a name="241557751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20FxHashMap%20implements%20TyEncodable/near/241557751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20FxHashMap.20implements.20TyEncodable.html#241557751">(Jun 04 2021 at 16:08)</a>:</h4>
<p>ahh no, right</p>



<a name="241557791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/where%20FxHashMap%20implements%20TyEncodable/near/241557791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/where.20FxHashMap.20implements.20TyEncodable.html#241557791">(Jun 04 2021 at 16:08)</a>:</h4>
<p>that's if I go with <code>TyEncodable</code>, but yeah, I need to impl <code>Encodable</code></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>